$(function(){
	$('.up').click(function(){
		var obj =$(this).parent().parent().parent();
		var v = obj.find("input").val();
			$('div input').attr('disabled','disabled');
			var str = "<tr id='uptr'><td align='center' colspan='6' bgcolor='#FFFFFF'><form action='mgruser!update.do' method='post' id='upform'><table width='700' border='0' cellpadding='0' cellspacing='1'>";
			str +="<tr bgcolor='#353c44' align='center'><td>用户名</td><td>邮箱</td><td>QQ</td><td>操作</td></tr>";
			str +="<tr bgcolor='#d3eaef' align='center'><td>";
			str +="<input type='hidden' name='uid' value='"+v+"'>";
			str +="<input type='text' name='username' value='"+$('#spun'+v).html()+"' readonly='readonly' style='border: 0px;background-color: #EEE;'></td>";
			str +="<td><input type='text' name='email' value='"+$.trim($('#spem'+v).html())+"'></td>";
			str +="<td><input type='text' name='qq' value='"+$.trim($('#spqq'+v).html())+"'></td>";
			str +="<td><input type='submit' value='保存' id='sub'><input style='margin-left:30px;' type='button' value='取消' onclick='cancel()'/></td>";
			str +="</table></form></td></tr>";
			obj.after(str);
	});
	
	$("#sub").live("click", function(){
		$('#upform').validate({
			errorPlacement: function(error, element) {},
			rules:{
				email:{
					required:true,
					email:true
				},
				qq:{
					required:true,
					number:true
				}
			}
		});
	});
	
	
});
function cancel(){
	$('div input').attr('disabled','');
	$('#uptr').remove();
}